library(SingleCellExperiment)
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
##
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
##
## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
## colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
## colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
## colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
## colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
## colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
## colWeightedMeans, colWeightedMedians, colWeightedSds,
## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
## rowWeightedSds, rowWeightedVars
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: BiocGenerics
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
## match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
## Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
## table, tapply, union, unique, unsplit, which.max, which.min
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
##
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
##
## rowMedians
## The following objects are masked from 'package:matrixStats':
##
## anyMissing, rowMedians
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ lubridate::%within%() masks IRanges::%within%()
## ✖ dplyr::collapse() masks IRanges::collapse()
## ✖ dplyr::combine() masks Biobase::combine(), BiocGenerics::combine()
## ✖ dplyr::count() masks matrixStats::count()
## ✖ dplyr::desc() masks IRanges::desc()
## ✖ tidyr::expand() masks S4Vectors::expand()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks S4Vectors::first()
## ✖ dplyr::lag() masks stats::lag()
## ✖ ggplot2::Position() masks BiocGenerics::Position(), base::Position()
## ✖ purrr::reduce() masks GenomicRanges::reduce(), IRanges::reduce()
## ✖ dplyr::rename() masks S4Vectors::rename()
## ✖ lubridate::second() masks S4Vectors::second()
## ✖ lubridate::second<-() masks S4Vectors::second<-()
## ✖ dplyr::slice() masks IRanges::slice()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(glue)
##
## Attaching package: 'glue'
##
## The following object is masked from 'package:SummarizedExperiment':
##
## trim
##
## The following object is masked from 'package:GenomicRanges':
##
## trim
##
## The following object is masked from 'package:IRanges':
##
## trim
library(lemur)
##
## Attaching package: 'lemur'
##
## The following object is masked from 'package:dplyr':
##
## vars
##
## The following object is masked from 'package:ggplot2':
##
## vars
source("util.R")
variation <- "random_holdout_hvg"
dataset_labels <- c("angelidis" = "Angelidis", "aztekin" = "Aztekin", "bunis" = "Bunis",
"goldfarbmuren" = "Goldfarbmuren", "hrvatin" = "Hrvatin",
"jakel" = "Jakel", "sathyamurthy" = "Sathyamurthy", "kang" = "Kang",
"skinnider" = "Skinnider", "bhattacherjee" = "Bhattacherjee", "canogamez" = "Canogamez",
"reyfman" = "Reyfman", "mouse_gastrulation" = "Pijuan-Sala")
method_labels <- c("PCA" = "PCA", "harmony" = "Harmony", "invertible_harmony" = "Param. Harmony",
"multiCondPCA" = "Rigid LEMUR", "lemur" = "LEMUR", "CPA" = "CPA", "scvi" = "scVI")
int_data <- read_tsv(glue("../benchmark/output/integration_results-{variation}.tsv")) %>%
mutate(method = ifelse(method == "CPA_kangparams", "CPA", method)) %>%
dplyr::select(-ends_with("_onlog")) %>%
dplyr::rename_with(\(x) str_remove(x, "_onself"), ends_with("_onself"))
## Rows: 169 Columns: 21
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (4): data, method, status, comparison
## dbl (16): mmd, wasserstein, mix, ARI_onlog, AMI_onlog, NMI_onlog, ARI_onself...
## lgl (1): job
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
int_data
## # A tibble: 169 × 18
## data method job status mmd wasserstein mix ARI AMI NMI overlap
## <chr> <chr> <lgl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 ange… CPA NA done 0.00570 1.03 8.64 0.546 0.668 0.670 5.71
## 2 ange… CPA NA done 0.00603 1.02 8.96 0.464 0.638 0.648 5.36
## 3 ange… scvi NA done 0.0125 0.917 5.53 0.669 0.799 0.802 9.22
## 4 ange… scvi NA done 0.0113 0.897 5.90 0.523 0.738 0.749 9.15
## 5 ange… harmo… NA done 0.0215 0.898 5.27 0.843 0.903 0.906 18.6
## 6 ange… PCA NA done 0.0422 0.992 2.67 1 1 1 20
## 7 ange… PCA NA done 0.0415 0.951 2.86 1 1 1 20
## 8 ange… lemur NA done 0.0188 0.885 4.49 0.709 0.841 0.844 15.0
## 9 ange… lemur NA done 0.0183 0.856 4.83 0.702 0.847 0.852 13.3
## 10 ange… inver… NA done 0.0210 0.890 5.08 0.670 0.861 0.864 18.1
## # ℹ 159 more rows
## # ℹ 7 more variables: celltypeSS_over_totalSS <dbl>,
## # batchSS_over_totalSS <dbl>, comparison <chr>, `stat-elapsed` <dbl>,
## # `stat-user` <dbl>, `stat-sys` <dbl>, `stat-max_mem_kbytes` <dbl>
methods <- c("PCA", "harmony", "invertible_harmony", "multiCondPCA", "lemur", "CPA", "scvi")
setdiff(unique(int_data$method), methods)
## character(0)
int_metrics <- vars(mmd, wasserstein, mix, overlap, ARI, AMI, NMI, celltypeSS_over_totalSS, batchSS_over_totalSS)
perf_data <- int_data %>%
mutate(mmd = log(mmd)) %>%
dplyr::select(data, method, comparison, !!! int_metrics) %>%
pivot_longer(all_of(map_chr(int_metrics, rlang::as_name)), names_to = "metric")
condition_labels <- c("holdout_vs_train" = "Holdout", "train_vs_train" = "Training")
suppl_int_mix_plt <- perf_data %>%
mutate(method = factor(method, levels = methods)) %>%
filter(metric %in% c("mmd", "wasserstein", "mix", "batchSS_over_totalSS")) %>%
mutate(metric = factor(metric, levels = c("mix", "mmd", "wasserstein", "batchSS_over_totalSS"),
labels = c("kNN Mix $\\uparrow$", "$\\log$ MMD $\\downarrow$", "Wasserstein $\\downarrow$", "Var. explained by condition $\\downarrow$"))) %>%
ggplot(aes(x = method, y = value)) +
ggbeeswarm::geom_quasirandom(size = 0.4, width = 0.3) +
stat_summary(geom = "pointrange", fun.data = mean_se, color = "red", size = 1, fatten = 1) +
ggh4x::facet_grid2(vars(comparison), vars(metric), scales = "free_y", independent = "y",
labeller = labeller(comparison = as_labeller(condition_labels)),
strip = ggh4x::strip_vanilla(clip = "off")) +
scale_x_discrete(labels = method_labels) +
scale_y_continuous(breaks = scales::breaks_extended(n = 3)) +
scale_color_discrete(labels = condition_labels) +
guides(x = guide_axis(angle = 90)) +
theme(panel.grid.major.y = element_line(colour = "grey50"), axis.title = element_blank(),
panel.spacing.y = unit(5, "mm")) +
labs(title = "(A) Integration of conditions")
suppl_int_signal_plt1 <- perf_data %>%
mutate(method = factor(method, levels = methods)) %>%
filter(metric %in% c("ARI", "NMI", "celltypeSS_over_totalSS")) %>%
mutate(metric = factor(metric, levels = c("ARI", "NMI", "celltypeSS_over_totalSS"),
labels = c( "ARI $\\uparrow$", "NMI $\\uparrow$", "Var. explained by cell type $\\uparrow$"))) %>%
ggplot(aes(x = method, y = value)) +
ggbeeswarm::geom_quasirandom(size = 0.4, width = 0.3) +
stat_summary(geom = "pointrange", fun.data = mean_se, color = "red", size = 1, fatten = 1) +
ggh4x::facet_grid2(vars(comparison), vars(metric), scales = "free_y", independent = "y",
labeller = labeller(comparison = as_labeller(condition_labels)),
strip = ggh4x::strip_vanilla(clip = "off")) +
scale_x_discrete(labels = method_labels) +
scale_y_continuous(breaks = c(0, 0.5, 1), limits = c(0, 1), expand = expansion(add = 0)) +
guides(x = guide_axis(angle = 90)) +
theme(panel.grid.major.y = element_line(colour = "grey50"), axis.title = element_blank(),
panel.spacing.y = unit(5, "mm")) +
labs(title = "")
suppl_int_signal_plt2 <- perf_data %>%
mutate(method = factor(method, levels = methods)) %>%
filter(metric %in% c("overlap")) %>%
mutate(metric = factor(metric, levels = c("overlap"),
labels = c("$k$-NN Overlap $\\uparrow$"))) %>%
ggplot(aes(x = method, y = value)) +
ggbeeswarm::geom_quasirandom(size = 0.4, width = 0.3) +
stat_summary(geom = "pointrange", fun.data = mean_se, color = "red", size = 1, fatten = 1) +
ggh4x::facet_grid2(vars(comparison), vars(metric), scales = "free_y", independent = "y",
labeller = labeller(comparison = as_labeller(condition_labels)),
strip = ggh4x::strip_vanilla(clip = "off")) +
scale_x_discrete(labels = method_labels) +
scale_y_continuous(breaks = c(0, 5, 10, 15, 20), limits = c(0, 20), expand = expansion(add = 0)) +
guides(x = guide_axis(angle = 90)) +
theme(panel.grid.major.y = element_line(colour = "grey50"), axis.title = element_blank(),
panel.spacing.y = unit(5, "mm"), strip.text.y = element_blank()) +
labs(title = "(B) Biological signal retention")
suppl_int_ss_plt <- perf_data %>%
mutate(method = factor(method, levels = methods)) %>%
filter(metric %in% c("celltypeSS_over_totalSS", "batchSS_over_totalSS")) %>%
pivot_wider(id_cols = c(data, method, comparison), names_from = metric, values_from = value) %>%
mutate(rel_SS = batchSS_over_totalSS / celltypeSS_over_totalSS) %>%
mutate(metric = "$\\downarrow$") %>%
ggplot(aes(x = method, y = rel_SS)) +
ggbeeswarm::geom_quasirandom(size = 0.4, width = 0.3) +
stat_summary(geom = "pointrange", fun.data = mean_se, color = "red", size = 1, fatten = 1) +
ggh4x::facet_grid2(vars(comparison), vars(metric), scales = "free_y", independent = "y",
labeller = labeller(comparison = as_labeller(condition_labels)),
strip = ggh4x::strip_vanilla(clip = "off")) +
scale_x_discrete(labels = method_labels) +
scale_y_log10(breaks = c(0.1, 1e-3, 1e-5), labels = paste0("$10^{", c(-1, -3, -5), "}$"),
limits = c(1e-5, 0.3), expand = expansion(mult = 0)) +
scale_color_discrete(labels = condition_labels) +
guides(x = guide_axis(angle = 90)) +
theme(panel.grid.major.y = element_line(colour = "grey50"), axis.title = element_blank(),
panel.spacing.y = unit(5, "mm")) +
labs(title = "(C) Ratio of variance explained $\\frac{\\text{condition}}{\\text{cell type}}$ (log-scale)")
plot_assemble(
add_plot(suppl_int_mix_plt + guides(color = "none"), x = 0, y = 0, width = 170, height = 60),
add_plot(suppl_int_signal_plt2 + guides(color = "none"), x = 0, y = 60, width = 40, height = 60),
add_plot(suppl_int_signal_plt1 + guides(color = "none"), x = 40, y = 60, width = 130, height = 60),
add_plot(suppl_int_ss_plt + guides(color = "none"), x = 0, y = 120, width = 46, height = 60),
width = 170, height = 180, units = "mm", show_grid_lines = FALSE,
latex_support = TRUE, filename = "../plots/suppl_integration_all_metrics.pdf"
)
## Creating new TikZ metrics dictionary at:
## benchmark_results-tikzDictionary
## Using TikZ metrics dictionary at:
## benchmark_results-tikzDictionary
## Measuring dimensions of: \char77
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb75d41261' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char103
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3602dab6' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char106
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7564fe6d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char112
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb397be251' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char113
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb74475152' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char121
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb762c1a21' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char81
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4967a923' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: gjpqyQ
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb34915e7b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: PCA
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb33d1f833' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Harmony
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1dfdf6d9' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Param. Harmony
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbc592ff1' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Rigid LEMUR
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb335a7d8c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb79e88caa' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: CPA
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb126b2b6d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: scVI
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb39f00a8d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3e44ccb2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb16dada0e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: -5.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7a21d8da' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: -4.0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb44240eda' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.8
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1b4b2d29' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.00
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6481ecbe' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.05
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbddde17f' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.10
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb61ff5ff5' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: kNN Mix $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb44f50016' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\log$ MMD $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb30d8c7b8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Wasserstein $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb68201a15' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Var. explained by condition $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb13908e1b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Holdout
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb776198a5' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Training
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb286cb5de' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char77
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7918168d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char103
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1c70c117' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char106
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2e94db97' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char112
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2edcae65' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char113
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1a3d80ec' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char121
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3bdb1369' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \char81
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2bd77132' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: gjpqyQ
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4d48a01a' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(A) Integration of conditions
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5b073299' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}\char77
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb358b097f' 'tikzStringWidthCalc.tex'
## gg[gg1]
## Measuring dimensions of: 10
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3b1c8c4f' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 15
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4f3fb4da' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 20
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5f7a7cdb' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k$-NN Overlap $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb629b3ed5' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(B) Biological signal retention
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3e3a4486' 'tikzStringWidthCalc.tex'
## gg[gg2]
## Measuring dimensions of: 0.0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6368d954' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb78944cc8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 1.0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb503d1c50' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: ARI $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5c0df157' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: NMI $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb175fb5f8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Var. explained by cell type $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbca3b8c5' 'tikzStringWidthCalc.tex'
## gg[gg3]
## Measuring dimensions of: $10^{-1}$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb50b793fe' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $10^{-3}$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb44553218' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $10^{-5}$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb354be8b4' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfba9a9cc2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(C) Ratio of variance explained $\frac{\text{condition}}{\text{cell type}}$ (log-scale)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2ca989fe' 'tikzStringWidthCalc.tex'
## gg[gg4]
bootstrap <- function(data, FUN, n_iterations = 1000, map_fun = purrr::map){
n <- nrow(data)
tibble(bootstrap_iteration = seq_len(n_iterations),
value = map_fun(seq_len(n_iterations), \(idx){
sel <- sample.int(n, size = n, replace = TRUE)
FUN(data[sel,])
}))
}
faithful %>%
as_tibble() %>%
mutate(group = eruptions < 3) %>%
reframe(means = bootstrap(cbind(eruptions, waiting), \(mat) matrix(colMeans(mat), nrow = 1), n_iterations = 100),
.by = group) %>%
unpack(means) %>%
unnest(value) %>%
ggplot(aes(x = value[,1], y = value[,2])) +
geom_density2d(aes(color = group)) +
geom_point(data = faithful, aes(x = eruptions, y = waiting))
int_bio_df <- left_join(int_data %>% dplyr::select(data, method, comparison, mix),
perf_data %>%
filter(metric == "ARI") %>%
dplyr::rename(ARI = value) %>%
dplyr::select(-metric), by = c("data", "method", "comparison")) %>%
filter(comparison == "holdout_vs_train" | method == "harmony") %>%
filter(method %in% c("PCA", "harmony", "lemur", "CPA", "scvi")) %>%
mutate(method = factor(method, c("lemur", "PCA", "harmony", "CPA", "scvi"))) %>%
mutate(avg_mix = mean(mix),
avg_ARI = mean(ARI), .by = c(data))
int_bio_label_loc_df <- tibble::tribble(
~x, ~y, ~hjust, ~label,
0.40, 1.25, 1, "PCA",
0.96, 1.08, 1, "LEMUR",
1.20, 0.98, 0, "Harmony",
0.92, 0.75, 1, "scVI",
1.30, 0.62, 0, "CPA"
)
int_bio_pl <- int_bio_df %>%
mutate(method = as.character(method)) %>%
reframe(bootstrap_samples = bootstrap(cbind(mix / avg_mix, ARI / avg_ARI), \(mat) matrix(colMeans(mat), nrow = 1), n_iterations = 1000),
.by = c(method, comparison)) %>%
unpack(bootstrap_samples) %>%
unnest(value) %>%
ggplot(aes(x = value[,1], y = value[,2])) +
geom_density2d(aes(color = method), adjust = 3, contour_var = "ndensity", breaks = seq(0.9, 0.2, length.out = 3)) +
geom_point(data = int_bio_df, aes(x = mix / avg_mix, y = ARI / avg_ARI, color = stage(method, after_scale = colorspace::lighten(colour, 0.3))), alpha = 0.3, size = 0.1) +
# ggrepel::geom_text_repel(data = . %>% summarize(value = matrix(colMeans(value, na.rm=TRUE), nrow = 1), .by = method), aes(label = method_labels[method]),
# size = font_size_small / .pt, point.padding = unit(3, "mm") ) +
geom_text(data = int_bio_label_loc_df, aes(x = x, y = y, hjust = hjust, label = label), size = font_size_small / .pt) +
annotation_custom(grid::polylineGrob(x = c(0.91, 0.99), y = c(0.91, 0.99), gp = grid::gpar(fill = "black"), arrow = grid::arrow(ends = "last", type = "closed", angle = 20, length = unit(10 / 7, "mm")))) +
labs(y = "Biological signal retention\nARI normalized per dataset",x = "Integration of conditions\n$k$-NN mixing normalized per dataset") +
scale_x_continuous(breaks = c(0, 1, 2), expand = expansion(add = c(0, 0.05))) +
scale_y_continuous(breaks = c(0, 1), expand = expansion(add = c(0, 0.05))) +
guides(color = "none") +
coord_fixed(xlim = c(0, 1.7), ylim = c(0, 1.3))
int_bio_pl
kang_vis <- read_tsv("../benchmark/output/kang_visualization-random_holdout_hvg.tsv") %>%
filter(method != "CPA" & method != "CPA_large") %>%
mutate(method = ifelse(method == "CPA_kangparams", "CPA", method))
## Rows: 192418 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (7): data, method, status, name, covariate, sample, celltype
## dbl (6): umap1, umap2, tsne1, tsne2, pca1, pca2
## lgl (2): job, is_holdout
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
kang_vis
## # A tibble: 167,745 × 15
## data method job status name covariate sample celltype is_holdout umap1
## <chr> <chr> <lgl> <chr> <chr> <chr> <chr> <chr> <lgl> <dbl>
## 1 kang CPA NA done AAACA… ctrl patie… CD14+ M… FALSE -0.202
## 2 kang CPA NA done AAACA… ctrl patie… CD14+ M… FALSE 2.21
## 3 kang CPA NA done AAACA… ctrl patie… CD4 T c… FALSE 0.644
## 4 kang CPA NA done AAACA… ctrl patie… CD14+ M… FALSE 1.04
## 5 kang CPA NA done AAACA… ctrl patie… Dendrit… FALSE 2.78
## 6 kang CPA NA done AAACA… ctrl patie… CD4 T c… FALSE 0.0801
## 7 kang CPA NA done AAACA… ctrl patie… CD14+ M… FALSE -0.410
## 8 kang CPA NA done AAACA… ctrl patie… CD4 T c… FALSE 1.84
## 9 kang CPA NA done AAACA… ctrl patie… CD14+ M… FALSE 0.414
## 10 kang CPA NA done AAACA… ctrl patie… CD4 T c… FALSE -0.478
## # ℹ 167,735 more rows
## # ℹ 5 more variables: umap2 <dbl>, tsne1 <dbl>, tsne2 <dbl>, pca1 <dbl>,
## # pca2 <dbl>
kang_umap_annot_df <- perf_data %>%
filter(data == "kang") %>%
filter(metric %in% c("ARI", "mix")) %>%
filter(comparison == "holdout_vs_train" | method == "harmony") %>%
filter(method %in% c("PCA", "harmony", "lemur", "CPA", "scvi")) %>%
mutate(method = factor(method, c("lemur", "PCA", "harmony", "CPA", "scvi"))) %>%
pivot_wider(names_from = "metric", values_from = "value")
kang_plot <- kang_vis %>%
filter(method %in% c("PCA", "harmony", "lemur", "CPA", "scvi")) %>%
mutate(method = factor(method, c("lemur", "PCA", "harmony", "CPA", "scvi"))) %>%
mutate(is_holdout = ! is.na(is_holdout) & is_holdout) %>%
sample_frac(n = 1) %>%
ggplot(aes(x = umap1, y = umap2)) +
ggrastr::rasterize(geom_point(aes(color = covariate), size = 0.05, stroke = 0), dpi = 600) +
geom_text(data = kang_umap_annot_df, aes(x = 0, y = Inf, label = glue("$k\\textrm{{NN}} = {sprintf('%.2f', mix)}$")),
size = font_size_small / .pt, hjust = 0.5, vjust = 1.5) +
geom_text(data = kang_umap_annot_df, aes(x = 0, y = Inf, label = glue("$\\textrm{{ARI}} = {sprintf('%.2f', ARI)}$")),
size = font_size_small / .pt, hjust = 0.5, vjust = 3) +
scale_color_manual(values = c("ctrl" = "#FC8D62", "stim" = "#8DA0CB")) +
facet_wrap(vars(method), nrow = 1, labeller = as_labeller(c("lemur" = "LEMUR", "CPA" = "CPA", "PCA" = "PCA", "harmony" = "Harmony", "scvi" = "scVI"))) +
guides(color = guide_legend(override.aes = list(size = 2))) +
small_axis(label = "UMAP", fontsize = font_size_small) +
labs(color = "Cell condition",
title = "(A) Latent space ($\\matr{Z}$) of Lupus patient samples treated with IFN-$\\beta$ (Kang)") +
theme(legend.position = "bottom")
kang_plot
kang_plot_cell_type <- kang_vis %>%
filter(method == "lemur") %>%
sample_frac(n = 1) %>%
ggplot(aes(x = umap1, y = umap2)) +
ggrastr::rasterize(geom_point(aes(color = celltype), size = 0.05, stroke = 0), dpi = 600) +
guides(color = "none") +
small_axis(label = "UMAP", fontsize = font_size_small) +
labs(title = "(C) $\\matr{Z}$ colored by\ncell type")
kang_plot_cell_type
pred_data <- read_tsv(glue("../benchmark/output/prediction_results-{variation}.tsv")) %>%
filter(method != "CPA" & method != "CPA_large") %>%
mutate(method = ifelse(method == "CPA_kangparams", "CPA", method))
## Rows: 468 Columns: 19
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (4): data, method, status, comparison
## dbl (14): l2_mean, l2_sd, r2_mean, r2_sd, l2_mean_per_celltype, l2_sd_per_ce...
## lgl (1): job
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
pred_methods <- c("linear", "PCA", "harmony", "invertible_harmony", "multiCondPCA", "lemur", "CPA", "scvi", "no_change")
pred_method_labels <- c("linear" = "Linear", "PCA" = "PCA", "harmony" = "Harmony", "invertible_harmony" = "Param. Harmony",
"multiCondPCA" = "Rigid LEMUR", "lemur" = "LEMUR", "CPA" = "CPA", "scvi" = "scVI", "no_change" = "Identity")
pred_metrics <- c("l2_mean", "l2_mean_per_celltype", "l2_sd", "l2_sd_per_celltype", "r2_mean",
"r2_mean_per_celltype", "r2_sd", "r2_sd_per_celltype", "mmd", "wasserstein")
pred_metrics_labels <- c("l2_mean" = "$L_2$ over all cells $\\downarrow$", "l2_mean_per_celltype" = "$L_2$ per cell type $\\downarrow$",
"l2_sd" = "$L_2$ of S.D. over all cells $\\downarrow$", "l2_sd_per_celltype" = "$L_2$ of S.D. per cell type $\\downarrow$",
"mmd" = "$\\log$ MMD $\\downarrow$", "r2_mean" = "$R^2$ over all cells $\\uparrow$",
"r2_mean_per_celltype" = "$R^2$ per cell type $\\uparrow$", "r2_sd" = "$R^2$ of S.D. over all cells $\\uparrow$",
"r2_sd_per_celltype" = "$R^2$ of S.D. per cell type $\\uparrow$", "wasserstein" = "Wasserstein distance $\\downarrow$")
pred_data_long <- pred_data %>%
dplyr::select(data, method, comparison, mmd, wasserstein, starts_with("l2"), starts_with("r2")) %>%
mutate(mmd = log10(mmd)) %>%
pivot_longer(c(mmd, wasserstein, starts_with("l2"), starts_with("r2")), names_to = "metric")
norm_metric <- c("l2_mean", "l2_mean_per_celltype", "l2_sd", "l2_sd_per_celltype", "wasserstein")
full_data_rel <- pred_data_long %>%
mutate(mean_value = mean(value, na.rm=TRUE), .by = c(data, metric)) %>%
mutate(rel_perf = value / mean_value) %>%
mutate(method = factor(method, levels = pred_methods)) %>%
mutate(metric = factor(metric, levels = pred_metrics)) %>%
mutate(is_perf = ifelse(str_starts(comparison, "holdout"), "holdout", "training"))
full_data_rel %>%
filter(metric == "l2_mean") %>%
summarize(mean_value = mean(value), min = min(value), max = max(value), .by = data) %>%
summarise(across(everything(), list(min=min, max=max), .names = "{.col}-{.fn}"))
## # A tibble: 1 × 8
## `data-min` `data-max` `mean_value-min` `mean_value-max` `min-min` `min-max`
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 angelidis skinnider 1.10 174. 6.11e-15 4.30
## # ℹ 2 more variables: `max-min` <dbl>, `max-max` <dbl>
pl1 <- full_data_rel %>%
filter(metric %in% norm_metric) %>%
mutate(rel_perf = ifelse(rel_perf > 2.5, Inf, rel_perf)) %>%
ggplot(aes(x = method, y = rel_perf)) +
geom_hline(yintercept = 1) +
# geom_point(data = . %>% filter(is.infinite(rel_perf)), size = 0.2) + # filtering breaks the x-axis order thus hack alpha
geom_point(aes(alpha = is.infinite(rel_perf) * 1.0), size = 0.2, show.legend = FALSE) +
ggbeeswarm::geom_quasirandom(size = 0.2) +
geom_pointrange(data = full_data_rel %>% filter(metric %in% norm_metric) %>%
summarize(rel_perf = mean_se(rel_perf), .by = c(method, metric)),
aes(y = rel_perf$y, ymin = rel_perf$ymin, ymax = rel_perf$ymax), color = "red", fatten = 1, size = 1) +
facet_grid(vars(is_perf), vars(metric), labeller = labeller(metric = as_labeller(pred_metrics_labels))) +
scale_x_discrete(labels = pred_method_labels, breaks = pred_methods) +
scale_y_continuous(breaks = c(0, 1, 2, 2.6), labels = c(0, 1, 2, "$>$2.5"), limits = c(0, 2.6), expand = expansion(add = 0)) +
scale_alpha_identity() +
coord_cartesian(clip = "off") +
guides(x = guide_axis(angle = 90)) +
theme(axis.title.x = element_blank(), plot.title.position = "plot",
panel.spacing.y = unit(5, "mm"), panel.spacing.x = unit(3, "mm")) +
labs(title = "Distance and correlation measures between predicted and observed expression",
subtitle = "There are two points per dataset (A vs B and B vs A)",
y = "distance (normalized per dataset)")
pl2 <- full_data_rel %>%
filter(str_starts(metric, "r2")) %>%
mutate(value = ifelse(value < 0.5, -Inf, value)) %>%
ggplot(aes(x = method, y = value)) +
# geom_point(data = . %>% filter(is.infinite(rel_perf)), size = 0.2) + # filtering breaks the x-axis order thus hack alpha
geom_point(aes(alpha = is.infinite(rel_perf) * 1.0), size = 0.2, show.legend = FALSE) +
ggbeeswarm::geom_quasirandom(size = 0.2) +
geom_pointrange(data = full_data_rel %>% filter(str_starts(metric, "r2")) %>%
summarize(value = mean_se(value), .by = c(method, metric)),
aes(y = value$y, ymin = value$ymin, ymax = value$ymax), color = "red", fatten = 1, size = 1) +
facet_grid(vars(is_perf), vars(metric), scales = "free_y", labeller = labeller(metric = as_labeller(pred_metrics_labels))) +
scale_x_discrete(labels = pred_method_labels) +
scale_y_continuous(breaks = c(0.5, 0.75, 1), labels = c("$<$0.5", 0.75, 1), limits = c(0.5, 1), expand = expansion(add = 0)) +
coord_cartesian(clip = "off") +
guides(x = guide_axis(angle = 90)) +
theme(axis.title.x = element_blank(), plot.title.position = "plot",
strip.text.y.right = element_blank(),
panel.spacing.y = unit(5, "mm"), , panel.spacing.x = unit(3, "mm")) +
labs(title = "", y = "correlation")
pl3 <- full_data_rel %>%
filter(metric == "mmd") %>%
ggplot(aes(x = method, y = value)) +
ggbeeswarm::geom_quasirandom(size = 0.2) +
geom_pointrange(data = full_data_rel %>% filter(metric == "mmd") %>% summarize(value = mean_se(value), .by = c(method, metric)),
aes(y = value$y, ymin = value$ymin, ymax = value$ymax), color = "red", fatten = 1, size = 1) +
facet_grid(vars(is_perf), vars(metric), scales = "free_y", labeller = labeller(metric = as_labeller(pred_metrics_labels))) +
scale_x_discrete(labels = pred_method_labels) +
coord_cartesian(clip = "off") +
guides(x = guide_axis(angle = 90)) +
theme(axis.title = element_blank(), plot.title.position = "plot",
panel.spacing.y = unit(5, "mm")) +
labs(title = " ")
plot_assemble(
add_plot(pl1, x = 0, y = 0, width = 164, height = 70),
add_plot(pl2 , x = 0, y = 70, width = 131, height = 60),
add_plot(pl3, x = 131, y = 70, width = 37, height = 60),
width = 170, height = 130, units = "mm", show_grid_lines = FALSE,
latex_support = TRUE, filename = "../plots/suppl_prediction_all_metrics.pdf"
)
## Warning: Removed 65 rows containing missing values or values outside the scale
## range (`geom_point()`).
## Measuring dimensions of: Linear
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb276b6451' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Identity
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7b87160e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 1
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb61b9307d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 2
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb451e90aa' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $>$2.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb59abac59' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2$ over all cells $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb15c0350d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2$ per cell type $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7ddaf3a2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2$ of S.D. over all cells $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb31b1513b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2$ of S.D. per cell type $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb704c11f9' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Wasserstein distance $\downarrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb12302c08' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: holdout
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb189aca8c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: training
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5a67b9f2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: distance (normalized per dataset)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4fe0ed3c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}Distance and correlation measures between predicted and observed expression
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb37f7271c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: There are two points per dataset (A vs B and B vs A)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4328bbf8' 'tikzStringWidthCalc.tex'
## gg[gg1]
## Warning: Removed 104 rows containing missing values or values outside the scale
## range (`position_quasirandom()`).
## Warning: Removed 104 rows containing missing values or values outside the scale
## range (`geom_point()`).
## Warning: Removed 54 rows containing missing values or values outside the scale
## range (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale
## range (`geom_pointrange()`).
## Measuring dimensions of: $<$0.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb274cb93a' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.75
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1e14a2fe' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $R^2$ over all cells $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5cd8e11f' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $R^2$ per cell type $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb22a3e9d8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $R^2$ of S.D. over all cells $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb374d75ac' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $R^2$ of S.D. per cell type $\uparrow$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3e688b91' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: correlation
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb41a2fc99' 'tikzStringWidthCalc.tex'
## gg[gg2]
## Measuring dimensions of: -2.0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3375c279' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: -1.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7832b053' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: -1.0
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb47d656cb' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: -0.5
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb48dc4e45' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7796b961' 'tikzStringWidthCalc.tex'
## gg[gg3]
perf_pred_plot <- pred_data_long %>%
filter(metric %in% c("l2_mean_per_celltype")) %>%
filter(str_starts(comparison, "holdout[12]_")) %>%
filter(method %in% c("no_change", "lemur", "CPA", "scvi")) %>%
mutate(method = factor(method, c("lemur", "no_change", "CPA", "scvi"))) %>%
mutate(method = fct_rev(method)) %>%
mutate(metric = factor(metric, levels = c("l2_mean_per_celltype"))) %>%
mutate(mean_value = mean(value), .by = c(data, metric)) %>%
mutate(rel_perf = value / mean_value) %>%
ggplot(aes(x = rel_perf, y = method)) +
geom_vline(xintercept = 1, linewidth = 0.3, color = "black") +
ggbeeswarm::geom_quasirandom(color = "grey", width = 0.2, size = 0.5) +
stat_summary(geom = "pointrange", fun.data = mean_se, color = "red", size = 0.4) +
small_arrow(position = c(0.1, 0.01), offset = 0.03) +
facet_wrap(vars(metric), labeller = as_labeller(c("l2_mean_per_celltype" = "Prediction error for 13 datasets"))) +
scale_x_continuous(expand = expansion(mult = c(0, 0.1)), breaks = c(0, 1, 2)) +
scale_y_discrete(labels = c("lemur" = "LEMUR", "CPA" = "CPA", "no_change" = "Identity")) +
coord_cartesian(xlim = c(0, 2)) +
theme(axis.title.y = element_blank(), plot.title.position = "plot") +
labs(title = "(D) Prediction performance", x = "Mean $L_2 = ||\\textrm{pred} - \\textrm{obs}||_2$ per cell type")
perf_pred_plot
## Orientation inferred to be along y-axis; override with
## `position_quasirandom(orientation = 'x')`
kang_pred <- read_tsv("../benchmark/output/kang-detailed_prediction_results_random_holdout_hvg.tsv") %>%
pivot_longer(c(starts_with("stim"), starts_with("ctrl")), names_sep = "-", names_to = c("condition", "cell_type"), values_to = "expression") %>%
filter(method != "CPA" & method != "CPA_large") %>%
mutate(method = ifelse(method == "CPA_kangparams", "CPA", method))
## Rows: 5000 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (2): method, gene
## dbl (16): stim-NK cells, stim-CD4 T cells, stim-CD14+ Monocytes, stim-CD8 T ...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
l2_mean_dist_df <- pred_data_long %>%
filter(data == "kang") %>%
filter(metric == "l2_mean_per_celltype") %>%
filter(comparison == "holdout2_vs_obs2") %>%
dplyr::rename(method.pred = method) %>%
filter(method.pred %in% c("no_change", "lemur", "CPA", "scvi")) %>%
mutate(method.pred = factor(method.pred, c("lemur", "no_change", "CPA", "scvi")))
ct_scatter_plot <- tidylog::inner_join(filter(kang_pred, method != "obs"),
filter(kang_pred, method == "obs"), by = c("gene", "condition", "cell_type"), suffix = c(".pred", ".obs")) %>%
filter(method.pred %in% c("no_change", "lemur", "CPA", "scvi")) %>%
filter(condition == "stim") %>%
mutate(method.pred = factor(method.pred, c("lemur", "no_change", "CPA", "scvi"))) %>%
ggplot(aes(x = expression.obs, y = expression.pred)) +
geom_abline() +
ggrastr::rasterize(geom_point(aes(color = cell_type), size = 0.4, stroke = 0), dpi = 300) +
geom_text(data = l2_mean_dist_df, aes(x = 12, y = 22, label = glue("$L_2 = {sprintf('%.2f', value)}$")),
size = font_size_small / .pt, halign = 0.5, ) +
facet_wrap(vars(method.pred), nrow = 1, labeller = as_labeller(c("lemur" = "LEMUR", "CPA" = "CPA", "scvi" = "scVI", "no_change" = "Identity"))) +
guides(color = guide_legend(override.aes = list(size = 2))) +
coord_fixed() +
labs(color = "",
title = "(C) Predicted vs. observed gene expression per gene and cell type",
x = "Observed expression", y = "Predicted expression") +
theme(legend.position = "bottom", plot.title.position = "plot")
## inner_join: added 4 columns (method.pred, expression.pred, method.obs, expression.obs)
## > rows only in x ( 0)
## > rows only in y ( 0)
## > matched rows 64,000
## > ========
## > rows total 64,000
## Warning in geom_text(data = l2_mean_dist_df, aes(x = 12, y = 22, label =
## glue("$L_2 = {sprintf('%.2f', value)}$")), : Ignoring unknown parameters:
## `halign`
ct_scatter_plot
tidylog::inner_join(filter(kang_pred, method != "obs"),
filter(kang_pred, method == "obs"), by = c("gene", "condition", "cell_type"), suffix = c(".pred", ".obs")) %>%
filter(condition == "stim") %>%
ggplot(aes(x = expression.obs, y = expression.pred)) +
geom_abline() +
ggrastr::rasterize(geom_point(aes(color = cell_type), size = 0.4, stroke = 0), dpi = 300) +
facet_wrap(vars(method.pred), nrow = 1) +
guides(color = guide_legend(override.aes = list(size = 2))) +
coord_fixed() +
theme(legend.position = "bottom", plot.title.position = "plot")
## inner_join: added 4 columns (method.pred, expression.pred, method.obs, expression.obs)
## > rows only in x ( 0)
## > rows only in y ( 0)
## > matched rows 64,000
## > ========
## > rows total 64,000
lemur_fit <- readRDS("../benchmark/output/differential-expression-kang_lemur_fit.RDS")
nei <- as_tibble(readRDS("../benchmark/output/differential-expression-kang_lemur_fit-neighborhood.RDS"))
set.seed(1)
umap <- uwot::umap(as.matrix(t(lemur_fit$embedding)))
sel_gene <- 8
de_simulated_pl <- as_tibble(colData(lemur_fit)) %>%
mutate(umap) %>%
mutate(is_de = lemur_fit$rowData$is_de_cell[[sel_gene]]) %>%
mutate(is_de = ifelse(is_de, "DE", "Not DE")) %>%
mutate(is_de = fct_rev(is_de)) %>%
ggplot(aes(x = umap[,1], y = umap[,2])) +
ggrastr::rasterize(geom_point(aes(color = is_de), size = 0.05, stroke = 0), dpi = 600) +
small_axis(label = "UMAP", fontsize = font_size_small) +
labs(#title = "(F) Simulated DE",
color = "") +
guides(color = guide_legend(override.aes = list(size = 1))) +
theme(legend.position = "top")
de_expr_pl <- as_tibble(colData(lemur_fit)) %>%
mutate(umap) %>%
mutate(expr = assay(lemur_fit, "logcounts")[sel_gene,]) %>%
mutate(inside = colnames(lemur_fit) %in% nei$neighborhood[[sel_gene]]) %>%
ggplot(aes(x = umap[,1], y = umap[,2])) +
ggrastr::rasterize(geom_point(aes(color = expr), size = 0.1, stroke = 0), dpi = 600) +
# scale_color_viridis_c() +
colorspace::scale_color_continuous_sequential(limits = c(0, quantile(assay(lemur_fit, "logcounts")[sel_gene,], c(0.98))), oob = scales::oob_squish, palette = "Purples 2", n.breaks = 3) +
small_axis(label = "", fontsize = font_size_small, arrow_length = 5) +
labs(title = "", color = "Expr.") +
facet_wrap(vars(fake_condition), ncol = 1, labeller = as_labeller(c("fake_ctrl" = "Ctrl.", "fake_trt" = "Trt."))) +
guides(color = guide_colorbar(barwidth = unit(1, "mm")))
de_pred_pl <- as_tibble(colData(lemur_fit)) %>%
mutate(umap) %>%
mutate(de_pred = assay(lemur_fit, "DE")[sel_gene,]) %>%
ggplot(aes(x = umap[,1], y = umap[,2])) +
ggrastr::rasterize(geom_point(aes(color = de_pred), size = 0.05, stroke = 0), dpi = 600) +
# scale_colour_gradient2_rev(limits = c(-2.5, 2.5), oob = scales::oob_squish, breaks = c(-2, 0, 2), mid = "lightgrey") +
scale_color_de_gradient(limits = c(-2.5, 2.5), breaks = c(-2, 0, 2), mid_width = 0.2) +
small_axis(label = "UMAP", fontsize = font_size_small) +
labs(#title = "(G) Predicted DE + Neighborhood",
color = "$\\Delta$") +
guides(color = guide_colorbar(barwidth = unit(1, "mm")))
de_nei_pl <- as_tibble(colData(lemur_fit)) %>%
mutate(umap) %>%
mutate(is_de = lemur_fit$rowData$is_de_cell[[sel_gene]]) %>%
mutate(inside = colnames(lemur_fit) %in% nei$neighborhood[[sel_gene]]) %>%
ggplot(aes(x = umap[,1], y = umap[,2])) +
ggrastr::rasterize(geom_point(aes(color = is_de), size = 0.05, stroke = 0), dpi = 600) +
small_axis(label = "", fontsize = font_size_small, arrow_length = 5) +
guides(color = "none") +
labs(title = " ") +
facet_wrap(vars(inside), ncol = 1, , labeller = as_labeller(c("TRUE" = "Inside", "FALSE" = "Outside")))
de_simulated_pl
de_pred_pl
de_expr_pl
de_nei_pl
prec_recall_df <- read_tsv("../benchmark/output/differential_expression-kang-recall_precision.tsv.gz")
## Rows: 2200 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (3): data, vals, name
## dbl (6): adj_pval, TP, FP, FN, de_n_cells, nei_size
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
prec_recall_plot <- prec_recall_df %>%
mutate(recall = TP / de_n_cells,
precision = TP / nei_size) %>%
mutate(highlighted = case_when(
data == "kang" & vals == "ctrl" & name == glue::glue("simulated_gene-{sel_gene}") ~ "special",
adj_pval < 0.1 ~ "signif",
TRUE ~ "not signif"
)) %>%
arrange(highlighted) %>%
ggplot(aes(x = recall, y = precision)) +
ggrastr::rasterize(geom_point(aes(color = highlighted, size =highlighted )), dpi = 300) +
# geom_point(data = . %>% filter(highlighted == "special"), size = 0.7, color = "red") +
scale_x_continuous(expand = expansion(0), breaks = c(0, 0.25, 0.5, 0.75, 1), labels = c("0", "0.25", "0.5", "0.75", "1")) +
scale_y_continuous(expand = expansion(0), breaks = c(0, 0.5, 1), labels = c("0", "0.5", "1")) +
scale_color_manual(values = c("special" = "red", "signif" = "black", "not signif" = "lightgrey"),
labels = c("special" = "Example\nfrom E,F", "signif" = "signif. genes", "not signif" = "not signif. genes")) +
scale_size_manual(values = c("special" = 0.7, "signif" = 0.4, "not signif" = 0.1)) +
guides(color = guide_legend(override.aes = list(alpha = 1, size = 1.5)), size = "none") +
coord_cartesian(clip = "off") +
labs(title = "(G) Neigh. comparison with ground truth",
subtitle = paste0("Precision: fraction of neighborhood inside ground truth\n",
"Recall: fraction of ground truth inside neighborhood"),
color = "", x = "Recall", y = "Precision") +
theme(plot.title.position = "plot", legend.position = "bottom")
prec_recall_plot
de_power_fdr <- read_tsv("../benchmark/output/differential_expression_fdr_power-kmeans.tsv.gz") %>%
mutate(extra_settings = ifelse(str_starts(method, "lemur_edgeR_"), str_remove(method, "lemur_edgeR_"), NA)) %>%
separate(method, into = c("method", "de_framework"))
## Rows: 4851 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (3): data, vals, method
## dbl (4): TPR, TP, FDR, nominal_fdr
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Warning: Expected 2 pieces. Additional pieces discarded in 2541 rows [64, 65,
## 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, ...].
de_power_fdr %>% distinct(data, vals)
## # A tibble: 11 × 2
## data vals
## <chr> <chr>
## 1 angelidis 24m
## 2 angelidis 3m
## 3 goldfarbmuren heavy
## 4 goldfarbmuren never
## 5 hrvatin 0h
## 6 hrvatin 1h
## 7 hrvatin 4h
## 8 sathyamurthy form
## 9 kang ctrl
## 10 kang stim
## 11 reyfman Control
fdr_control_plot <- de_power_fdr %>%
filter(de_framework == "edgeR" & method == "lemur" & is.na(extra_settings)) %>%
ggplot(aes(x = nominal_fdr, y = FDR, group = paste0(data, method, vals))) +
geom_line(data = . %>% filter(method == "lemur"), color = "lightgrey", linewidth = 1) +
geom_line(data = . %>% filter(method == "lemur") %>% summarize(FDR = mean(FDR, na.rm = TRUE), .by = c(nominal_fdr)),
aes(group = 1), color = "darkblue", linewidth = 1.3) +
geom_abline() +
coord_fixed(ylim = c(0, 0.3), xlim = c(0, 0.2)) +
scale_x_continuous(expand = expansion(0), breaks = c(0, 0.1, 0.2), labels = c("0", "0.1", "0.2")) +
scale_y_continuous(expand = expansion(0)) +
labs(title = "(H) FDR control",
x = "Nominal FDR", y = "Observed FDR",
subtitle = "Eleven datasets (\\textcolor{blue!70!black}{mean})") +
theme(plot.title.position = "plot")
fdr_control_plot
power_plot <- de_power_fdr %>%
filter(de_framework == "edgeR" & is.na(extra_settings)) %>%
mutate(data = dataset_labels[data]) %>%
mutate(data_vals = glue::glue("{data}\n{vals}")) %>%
mutate(is_lemur = method == "lemur") %>%
ggplot(aes(x = nominal_fdr, y = TPR)) +
geom_hline(yintercept = 0, linewidth = 0.3) +
geom_line(aes(color = is_lemur, group = paste0(method)), show.legend = FALSE) +
scale_color_manual(values = c("TRUE" = "red", "FALSE" = "grey")) +
ggh4x::facet_wrap2(vars(data_vals), nrow = 3, strip = ggh4x::strip_vanilla(clip = "off")) +
coord_cartesian(ylim = c(0, 0.75), xlim = c(0, 0.2)) +
scale_x_continuous(expand = expansion(add = c(0, 0.02)), breaks = c(0, 0.1, 0.2), labels = c("0", "0.1", "0.2")) +
scale_y_continuous(expand = expansion(0)) +
labs(title = "(I) DE-test Power",
x = "Nominal FDR", y = "True positive rate (TPR)",
subtitle = "Comparison of \\textcolor{red}{LEMUR} against four other \\textcolor{gray!90}{DE. methods}") +
theme(plot.title.position = "plot", strip.text = element_text(margin = margin(b = unit(-1, "cm"))))
power_plot
de_power_fdr_with_label <- de_power_fdr %>%
mutate(es = extra_settings) %>%
mutate(extra_settings_pretty = case_when(
is.na(es) ~ "",
str_starts(es, "nemb_") ~ glue("$\\#\\text{{dimensions}} = {str_remove(es, 'nemb_')}$"),
str_starts(es, "testfrac_") ~ glue("$\\text{{test fraction}} = {as.numeric(str_remove(es, 'testfrac_')) * 100}\\%$"),
es == "sel_contrast" ~ "contrast selection",
es == "dir_contrast" ~ "contrast directions",
es == "skip_al" ~ "$\\matr{S}=I$ (rigid)",
es == "skip_multCondPCA" ~ "parametric Harmony",
es == "sf_method_ratio" ~ "ratio size factor",
es == "count_split" ~ "count splitting",
es == "notesttraining" ~ "no test/train split",
TRUE ~ es
)) %>%
mutate(method = factor(method, levels = c("global", "celltype", "cluster", "miloDE", "lemur"),
labels = c("Global", "Cell type", "Cluster", "miloDE", "LEMUR"))) %>%
mutate(method_label = case_when(
is.na(extra_settings) ~ glue("{method} ({de_framework})"),
!is.na(extra_settings) ~ glue("{method} ({de_framework})\nwith {extra_settings_pretty}")
)) %>%
mutate(data_vals = glue::glue("{data}\n{vals}"))
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `extra_settings_pretty = case_when(...)`.
## Caused by warning:
## ! NAs introduced by coercion
fdr_control_plots <- de_power_fdr_with_label %>%
group_by(method == "LEMUR") %>%
group_map(\(data, key){
ggplot(data, aes(x = nominal_fdr, y = FDR, group = paste0(data, vals, method_label))) +
geom_line(color = "lightgrey", linewidth = 1) +
geom_line(data = . %>% summarize(FDR = mean(FDR, na.rm = TRUE), .by = c(nominal_fdr, method_label)),
aes(group = 1), color = "darkblue", linewidth = 1.3) +
geom_abline() +
coord_fixed(ylim = c(0, 0.3), xlim = c(0, 0.2)) +
scale_x_continuous(expand = expansion(0), breaks = c(0, 0.1, 0.2), labels = c("0", "0.1", "0.2")) +
scale_y_continuous(expand = expansion(0)) +
ggh4x::facet_wrap2(vars(method_label), ncol = 7, strip = ggh4x::strip_vanilla(clip = "off")) +
labs(x = "Nominal FDR", y = "Observed FDR") +
theme(plot.title.position = "plot", panel.spacing.x = unit(5, "mm"))
})
all_methods_power <- de_power_fdr_with_label %>%
filter(nominal_fdr == 0.1) %>%
mutate(FDR = ifelse(is.na(FDR), 0, FDR)) %>%
mutate(controls_fdr = mean(FDR) < nominal_fdr, .by = c(method, de_framework, extra_settings)) %>%
mutate(rel_TPR = TPR / mean(TPR), .by = data_vals) %>%
mutate(method_label = str_replace(method_label, "\n", " ")) %>%
mutate(method_label = fct_reorder(method_label, rel_TPR, .fun = mean)) %>%
ggplot(aes(x = rel_TPR, y = method_label)) +
geom_vline(xintercept = 1, linewidth = 0.3, color = "black") +
ggbeeswarm::geom_quasirandom(color = "grey", width = 0.2, size = 0.5) +
stat_summary(aes(color = controls_fdr), geom = "pointrange", fun.data = mean_se, size = 0.4) +
ggh4x::facet_grid2(rows = vars(method), scales = "free_y", space = "free_y") +
scale_color_manual(values = c("TRUE" = "red", "FALSE" = "lightgrey")) +
labs(color = "FDR control on average", y = "", x = "Relative TPR") +
theme(strip.text = element_blank(), panel.spacing.y = unit(3, "mm"))
fdr_control_plots
## [[1]]
## Warning: Removed 146 rows containing missing values or values outside the scale
## range (`geom_line()`).
##
## [[2]]
## Warning: Removed 13 rows containing missing values or values outside the scale
## range (`geom_line()`).
all_methods_power
## Orientation inferred to be along y-axis; override with
## `position_quasirandom(orientation = 'x')`
plot_assemble(
add_text("(A) FDR control for all methods", x = 2.7, y = 2, fontsize = font_size, vjust = 1, fontface = "bold"),
add_plot(cowplot::plot_grid(plotlist = fdr_control_plots, ncol = 1, rel_heights = c(1,2)), x = 0, y = 5, width = 170, height = 120),
add_text("(B) Average power for all methods at $\\textrm{FDR} = 10\\%$", x = 2.7, y = 125, fontsize = font_size, vjust = 1, fontface = "bold"),
add_plot(all_methods_power, x = 0, y = 130, width = 130, height = 100),
width = 170, height = 230, units = "mm", show_grid_lines = FALSE,
latex_support = TRUE, filename = "../plots/suppl_all_fdr_power.pdf"
)
## Warning: Removed 146 rows containing missing values or values outside the scale
## range (`geom_line()`).
## Warning: Removed 13 rows containing missing values or values outside the scale
## range (`geom_line()`).
## Measuring dimensions of: \bfseries{}(A) FDR control for all methods
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6b58ae99' 'tikzStringWidthCalc.tex'
## gg[gg1]
## Measuring dimensions of: Observed FDR
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbb2ef5de' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Nominal FDR
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb380fc78e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cell type (edgeR)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb13f65863' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cell type (glmGamPoi)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1224d5d2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cluster (edgeR)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3051d74c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cluster (glmGamPoi)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4d0dd75c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Global (edgeR)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb47b60089' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Global (glmGamPoi)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7ddd4726' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: miloDE (edgeR)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4a6a5058' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.1
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb9c0e793' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 0.2
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb57a368e5' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR (edgeR)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb293bbf56' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with $\#\text{dimensions} = 8$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb118ebc40' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with $\#\text{dimensions} = 80$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb31e916c1' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with $\matr{S}=I$ (rigid)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3dd4f280' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with $\text{test fraction} = 20\%$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb677cd136' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with $\text{test fraction} = 80\%$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb338b654e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with contrast directions
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4a7fe52' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with contrast selection
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3129bbe1' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with count splitting
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2aedc9fe' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with no test/train split
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb616858b6' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with parametric Harmony
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb99846b0' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: with ratio size factor
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6c48d1bb' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR (glmGamPoi)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb20c18387' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR (limma)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfba224de' 'tikzStringWidthCalc.tex'
## gg[gg2]
## Measuring dimensions of: \bfseries{}(B) Average power for all methods at $\textrm{FDR} = 10\%$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb15226b25' 'tikzStringWidthCalc.tex'
## gg[gg3]
## Orientation inferred to be along y-axis; override with `position_quasirandom(orientation = 'x')`
## Measuring dimensions of: 1.5
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6a854fa' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 2.0
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1562ec80' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 2.5
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1194d278' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with parametric Harmony
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4185cd4c' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with $\text{test fraction} = 80\%$
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb37695a2f' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with contrast directions
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb659fe014' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with $\matr{S}=I$ (rigid)
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6330752b' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with $\#\text{dimensions} = 8$
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb25c8ced' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with ratio size factor
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfba281cd1' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with $\#\text{dimensions} = 80$
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4f7be28c' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with $\text{test fraction} = 20\%$
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4e567e18' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with contrast selection
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb107081d6' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with count splitting
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4a5c1108' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: LEMUR (edgeR) with no test/train split
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb62624a5b' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: FALSE
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb22ffced3' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: TRUE
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb48639098' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: FDR control on average
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbaa1049' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Relative TPR
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1d1328f6' 'tikzStringWidthCalc.tex'
##
## gg[gg4]
For which dataset is the FDR not controlled?
de_power_fdr_with_label %>%
filter(nominal_fdr == 0.01) %>%
filter(is.na(es)) %>%
mutate(FDR = ifelse(is.na(FDR), 0, FDR)) %>%
filter(FDR > 0.1) %>%
dplyr::count(data, vals) %>%
arrange(desc(n))
## # A tibble: 8 × 3
## data vals n
## <chr> <chr> <int>
## 1 hrvatin 4h 4
## 2 angelidis 24m 2
## 3 angelidis 3m 2
## 4 kang ctrl 2
## 5 kang stim 2
## 6 goldfarbmuren never 1
## 7 hrvatin 0h 1
## 8 sathyamurthy form 1
power_per_desize <- read_tsv("../benchmark/output/differential_expression_fdr_power-kmeans-stratified.tsv.gz")
## Rows: 35191 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (3): method, data_val, name
## dbl (1): de_size
## lgl (1): signif
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
power_per_desize_plot <- power_per_desize %>%
mutate(extra_settings = ifelse(str_starts(method, "lemur_edgeR_"), str_remove(method, "lemur_edgeR_"), NA)) %>%
separate(method, into = c("method", "de_framework")) %>%
filter(de_framework == "edgeR" & is.na(extra_settings)) %>%
mutate(method = factor(method, levels = c("lemur", "global", "cluster", "celltype", "miloDE"),
labels = c("LEMUR", "Global", "Cluster*", "Cell type*", "miloDE*"))) %>%
ggplot(aes(x = de_size)) +
geom_hline(yintercept = 0, linewidth = 0.3) +
geom_histogram(aes(fill = signif), bins = 30, show.legend = FALSE) +
ggh4x::facet_grid2(rows = vars(method), strip = ggh4x::strip_vanilla(clip = "off")) +
scale_fill_manual(values = c("TRUE" = "darkblue", "FALSE" = "lightgrey")) +
scale_x_log10(limits = c(50, NA), labels = scales::label_comma()) +
scale_y_continuous(expand = expansion(add = c(0, 10)), breaks = c(0, 100, 200)) +
labs(title = "(J) Power by no. cell with expr. change",
subtitle = "Fraction of simulated genes (\\textcolor{gray!60!black}{grey}) with $\\textrm{FDR} < 0.1$ (\\textcolor{blue!60!black}{blue})",
x = "No. cells with expr. change (log scale)", y = "No. genes") +
theme(plot.title.position = "plot")
## Warning: Expected 2 pieces. Additional pieces discarded in 24200 rows [201,
## 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
## 218, 219, 220, ...].
power_per_desize_plot
## Warning: Removed 50 rows containing non-finite outside the scale range
## (`stat_bin()`).
## Warning: Removed 10 rows containing missing values or values outside the scale
## range (`geom_bar()`).
var_expl <- read_tsv("../benchmark/output/variance_explained.tsv.gz")
## Rows: 3120 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (3): method, subset, dataset
## dbl (9): dimensions, var_expl, user.self, sys.self, elapsed, user.child, sys...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
var_expl_overall_pl <- var_expl %>%
bind_rows(var_expl %>% distinct(method, subset, dataset, n_genes, n_cells) %>% mutate(dimensions = 0, var_expl = 0)) %>%
filter(subset == "all") %>%
filter(! is.na(var_expl)) %>%
mutate(method = factor(method, levels = c("lemur", "pca"), labels = c("LEMUR", "PCA"))) %>%
mutate(dataset = fct_reorder(dataset, n_cells)) %>%
mutate(is_row_subset = n_genes == 500) %>%
ggplot(aes(x = dimensions, y = var_expl * 100)) +
geom_hline(yintercept = 0, linewidth = 0.3) +
geom_line(aes(color = method, linetype = method)) +
ggh4x::facet_grid2(vars(is_row_subset), vars(dataset),
labeller = ggplot2::labeller(is_row_subset = as_labeller(c("TRUE" = "500 HVG", "FALSE" = "All Genes")), dataset = as_labeller(dataset_labels)),
strip = ggh4x::strip_vanilla(clip = "off")) +
scale_x_continuous(breaks = c(0, 100, 200), expand = expansion(mult = c(0, 0.1))) +
scale_y_continuous(expand = expansion(mult = c(0)), breaks = c(0, 25, 50, 75, 100), limits = c(0, 100)) +
labs(y = "Percent variance explained", x = "Latent dimensions", color = "", linetype = "",
title = "(A) Variance explained") +
theme(legend.position = "bottom",
panel.grid.major.y = element_line("lightgrey", linewidth = 0.2),
panel.spacing.y = unit(5, "mm"), panel.spacing.x = unit(3, "mm"))
var_duration_pl1 <- var_expl %>%
filter(subset == "all" | is.na(subset)) %>%
filter(dimensions > 3) %>%
mutate(method = factor(method, levels = c("lemur", "pca", "lemur_landmark", "lemur_harmony"),
labels = c("LEMUR", "PCA", "LEMUR + Landmark Alignment", "LEMUR + Harmony Alignment"))) %>%
mutate(is_row_subset = n_genes == 500) %>%
mutate(original_n_genes = max(n_genes), .by = dataset) %>%
mutate(dataset = fct_reorder(dataset, n_cells)) %>%
group_by(is_row_subset) %>%
group_map(\(data, key){
is_subset <- key[[1]][1]
data$is_row_subset <- is_subset
# if(! is_subset){
data$elapsed <- data$elapsed / 60
# }
ggplot(data, aes(x = dimensions, y = elapsed)) +
geom_hline(yintercept = 0, linewidth = 0.3) +
geom_hline(yintercept = c(), linewidth = 0.3) +
geom_line(aes(color = method, linetype = method)) +
ggh4x::facet_grid2(vars(is_row_subset), vars(dataset, n_cells, original_n_genes),
labeller = ggplot2::labeller(is_row_subset = as_labeller(c("TRUE" = "500 HVG", "FALSE" = "All Genes")),
dataset = as_labeller(dataset_labels),
n_cells = as_labeller(\(x) glue("\\tiny{{$C={scales::comma_format()(as.numeric(x))}$}}")),
original_n_genes = as_labeller(\(x) glue("\\tiny{{$G={scales::comma_format()(as.numeric(x))}$}}"))),
strip = ggh4x::strip_vanilla(clip = "off"), scales = "free_y") +
scale_x_continuous(breaks = c(0, 100, 200), expand = expansion(mult = c(0, 0.1))) +
scale_y_continuous(expand = expansion(mult = c(0, 0.1))) +
scale_color_manual(values = scales::hue_pal()(4) |> magrittr::set_names(c("LEMUR", "LEMUR + Landmark Alignment", "PCA", "LEMUR + Harmony Alignment"))) +
scale_linetype_manual(values = c("LEMUR" = "solid", "LEMUR + Landmark Alignment" = "22", "PCA" = "22", "LEMUR + Harmony Alignment" = "solid")) +
coord_cartesian(ylim = c(0, if(is_subset) 4 else 11)) +
labs(y = "Elapsed time [min.]",
x = "Latent dimensions", color = "", linetype = "",
title = "(B) Computation Time") +
theme(legend.position = "bottom",
strip.text.x = element_text(color = if(is_subset) "#00000000" else "black", margin = margin(t = 0.3, b = 0, unit = "mm")),
plot.title = element_text(color = if(is_subset) "#00000000" else "black"),
panel.grid.major.y = element_line("lightgrey", linewidth = 0.2),
panel.spacing.y = unit(5, "mm"), panel.spacing.x = unit(3, "mm"))
})
var_expl_overall_pl
var_duration_pl1
## [[1]]
##
## [[2]]
var_expl %>%
filter(dataset == "goldfarbmuren") %>%
filter(dimensions == 50) %>%
filter(n_genes != 500)
## # A tibble: 8 × 12
## dimensions method subset var_expl user.self sys.self elapsed user.child
## <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 50 pca all 0.349 373. 0.295 35.2 0
## 2 50 pca never 0.353 373. 0.295 35.2 0
## 3 50 pca heavy 0.344 373. 0.295 35.2 0
## 4 50 lemur all 0.355 791. 11.1 103. 0
## 5 50 lemur never 0.360 791. 11.1 103. 0
## 6 50 lemur heavy 0.350 791. 11.1 103. 0
## 7 50 lemur_landma… <NA> NA 794. 12.6 105. 0
## 8 50 lemur_harmony <NA> NA 902. 31.4 198. 0
## # ℹ 4 more variables: sys.child <dbl>, dataset <chr>, n_genes <dbl>,
## # n_cells <dbl>
var_expl %>%
filter(dataset == "mouse_gastrulation") %>%
filter(dimensions == 200) %>%
filter(n_genes != 500)
## # A tibble: 8 × 12
## dimensions method subset var_expl user.self sys.self elapsed user.child
## <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 200 pca all 0.210 19669. 21.5 1303. 0
## 2 200 pca wt 0.258 19669. 21.5 1303. 0
## 3 200 pca chime… 0.196 19669. 21.5 1303. 0
## 4 200 lemur all 0.217 44023. 87.0 2995. 0
## 5 200 lemur wt 0.282 44023. 87.0 2995. 0
## 6 200 lemur chime… 0.199 44023. 87.0 2995. 0
## 7 200 lemur_landma… <NA> NA 44059. 114. 3015. 0
## 8 200 lemur_harmony <NA> NA 44673. 262. 3496. 0
## # ℹ 4 more variables: sys.child <dbl>, dataset <chr>, n_genes <dbl>,
## # n_cells <dbl>
plot_assemble(
add_plot(var_expl_overall_pl, x = 0, y = 0, width = 170, height = 60),
add_plot(var_duration_pl1[[1]] + guides(color = "none", linetype = "none"), x = 0, y = 60, width = 170, height = 35),
add_plot(var_duration_pl1[[2]], x = 0, y = 85, width = 170, height = 40),
width = 170, height = 125, units = "mm", show_grid_lines = FALSE,
latex_support = TRUE, filename = "../plots/suppl_variance_explained.pdf"
)
## Measuring dimensions of: 100
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb14e2b496' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 200
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2fbdee90' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 25
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5e79486c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 50
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6c81dae8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 75
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb414aecff' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Bunis
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1e0d7ad6' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Skinnider
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6fb8704' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Sathyamurthy
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6b5d1b30' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Canogamez
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2da42361' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Bhattacherjee
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb730eccaf' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Aztekin
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb50a0302c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Angelidis
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb44bac20e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Jakel
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb411a4862' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Kang
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb24863b52' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Goldfarbmuren
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb68a09739' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Reyfman
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb72854d9' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Hrvatin
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb68da763a' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Pijuan-Sala
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5e880f9d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: All Genes
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb36b93ce7' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 500 HVG
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3b4d7dc2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Percent variance explained
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5c7b69f8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(A) Variance explained
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2a6a4837' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Latent dimensions
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb27ab28a2' 'tikzStringWidthCalc.tex'
## gg[gg1]
## Measuring dimensions of: 3
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb55f8b806' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 6
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3bf9be02' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 9
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb9299411' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 12
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb8b7ecca' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=4,110$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb631ac63e' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=4,917$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb72cd4346' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=6,265$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1fbe38c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=8,146$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4017fd58' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=10,357$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb66f9bd47' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=10,554$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb15f9b522' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=11,800$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3ce2d673' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=14,226$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb506d373f' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=19,707$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb32463259' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=24,178$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1e938ad8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=42,903$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb68807a96' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=52,416$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4af04373' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$C=54,613$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb63dc5974' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=33,694$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb177501e4' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=27,933$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2cf2bc4' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=32,962$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6f42524c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=20,601$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6b2934a4' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=18,469$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5e3f31f2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=31,535$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6e83735' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=20,908$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb77807c1d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=21,581$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb14549136' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=15,706$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3c097aa7' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=20,953$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb125388bc' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=25,597$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2a35f80a' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=25,187$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3d2f6e2c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \tiny{$G=29,452$}
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb74ea2a15' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Elapsed time [min.]
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb397104aa' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(B) Computation Time
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2ae9525c' 'tikzStringWidthCalc.tex'
## gg[gg2]
## Measuring dimensions of: 4
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3c1e2c06' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR + Landmark Alignment
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb60dc5cbf' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: LEMUR + Harmony Alignment
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb234d3147' 'tikzStringWidthCalc.tex'
## gg[gg3]
plot_assemble(
add_plot(kang_plot, x = 0, y = 0, width = 117, height = 45),
add_text("(B) Integration Performance", x = 114.5, y = 1.5, fontsize = font_size, vjust = 1, fontface = "bold"),
add_plot(int_bio_pl, x = 113, y = 5, width = 55, height = 42),
add_plot(ct_scatter_plot + guides(color = "none"), x = 0, y = 50, width = 110, height = 40),
add_plot(cowplot::get_legend(ct_scatter_plot) , x = 10, y = 88, width = 75, height = 10),
add_plot(perf_pred_plot, x = 113, y = 50, width = 55, height = 40),
add_text("(E) Simulated DE", x = 2.7, y = 101.4, fontsize = font_size, vjust = 1, fontface = "bold"),
add_plot(de_simulated_pl, x = 0, y = 100, width = 30, height = 45),
add_plot(de_expr_pl, x = 25, y = 100, width = 30, height = 45),
add_text("(F) Predicted DE and neighborhood", x = 54, y = 101.4, fontsize = font_size, vjust = 1, fontface = "bold"),
add_plot(de_pred_pl, x = 53, y = 100, width = 40, height = 45),
add_plot(de_nei_pl, x = 83, y = 100, width = 35, height = 45),
add_plot(prec_recall_plot + guides(color = "none"), x = 113, y = 100, width = 55, height = 42),
add_plot(cowplot::get_legend(prec_recall_plot), x = 115, y = 140, width = 50, height = 5),
add_plot(fdr_control_plot, x = 0, y = 150, width = 40, height = 55),
add_plot(power_plot, x = 40, y = 150, width = 68, height = 55),
add_plot(power_per_desize_plot, x = 113, y = 150, width = 55, height = 55),
width = 170, height = 205, units = "mm", show_grid_lines = FALSE,
latex_support = TRUE, filename = "../plots/performance_validation.pdf"
)
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
## Measuring dimensions of: ctrl
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb43a9bc34' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: stim
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3c831ca0' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cell condition
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb43cc6b69' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(A) Latent space ($\matr{Z}$) of Lupus patient samples treated with IFN-$\beta$ (Kang)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb219fdd45' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k\textrm{NN} = 6.76$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb677ee42' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\textrm{ARI} = 0.68$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2bbb325f' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: UMAP
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbee81167' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k\textrm{NN} = 0.59$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb25ce88d6' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\textrm{ARI} = 1.00$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1a79acfe' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k\textrm{NN} = 6.91$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2a4c6546' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\textrm{ARI} = 0.89$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7d8cec5b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k\textrm{NN} = 8.19$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2ef18ac2' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\textrm{ARI} = 0.72$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb73ccdea1' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k\textrm{NN} = 6.19$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbf2c576c' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $\textrm{ARI} = 0.80$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb281f7b3c' 'tikzStringWidthCalc.tex'
## gg[gg1]
## Measuring dimensions of: \bfseries{}(B) Integration Performance
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2ad3b4b8' 'tikzStringWidthCalc.tex'
## gg[gg2]
## Measuring dimensions of: Biological signal retention
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb30fdb1ff' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: ARI normalized per dataset
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5fb0f579' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Integration of conditions
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5ac40c03' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $k$-NN mixing normalized per dataset
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7cf0c782' 'tikzStringWidthCalc.tex'
## gg[gg3]
## Measuring dimensions of: Predicted expression
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb23ba67e3' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(C) Predicted vs. observed gene expression per gene and cell type
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb22fa7a68' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Observed expression
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6a7a53c8' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2 = 2.09$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb512a615' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2 = 13.13$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbb55af4d' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2 = 12.83$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2667ee0b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: $L_2 = 3.94$
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb713d27df' 'tikzStringWidthCalc.tex'
## gg[gg4]
## gg[gg5]
## Orientation inferred to be along y-axis; override with `position_quasirandom(orientation = 'x')`
## Measuring dimensions of: scvi
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6604db8d' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Prediction error for 13 datasets
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb48ea3a4e' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: \bfseries{}(D) Prediction performance
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb999fc48' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Mean $L_2 = ||\textrm{pred} - \textrm{obs}||_2$ per cell type
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5c81dfe4' 'tikzStringWidthCalc.tex'
##
## gg[gg6]
##
## Measuring dimensions of: \bfseries{}(E) Simulated DE
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5292212e' 'tikzStringWidthCalc.tex'
##
## gg[gg7]
##
## Measuring dimensions of: Not DE
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb77c07d5b' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: DE
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7e661ec8' 'tikzStringWidthCalc.tex'
##
## gg[gg8]
##
## Measuring dimensions of: Ctrl.
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb626f1d4c' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Trt.
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6cec9b10' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Expr.
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb21b86f4e' 'tikzStringWidthCalc.tex'
##
## gg[gg9]
##
## Measuring dimensions of: \bfseries{}(F) Predicted DE and neighborhood
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb53937b2d' 'tikzStringWidthCalc.tex'
##
## gg[gg10]
##
## Measuring dimensions of: -2
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb777bf238' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: $\Delta$
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6a5b77d0' 'tikzStringWidthCalc.tex'
##
## gg[gg11]
##
## Measuring dimensions of: Outside
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1b172f3d' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Inside
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbf1e5bb0' 'tikzStringWidthCalc.tex'
##
## gg[gg12]
##
## Measuring dimensions of: 0.25
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb12158791' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Precision
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb437749dd' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: \bfseries{}(G) Neigh. comparison with ground truth
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4c926ec5' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Precision: fraction of neighborhood inside ground truth
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb21a66ec9' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Recall: fraction of ground truth inside neighborhood
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb35b35f61' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Recall
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb133af4d2' 'tikzStringWidthCalc.tex'
##
## gg[gg13]
##
## gg[gg14]
##
## Measuring dimensions of: \bfseries{}(H) FDR control
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb39f10db' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Eleven datasets (\textcolor{blue!70!black}{mean})
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb400b9bb8' 'tikzStringWidthCalc.tex'
##
## gg[gg15]
##
## Measuring dimensions of: 0.4
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3a1c6de1' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 0.6
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2071ec95' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 24m
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb17633ad7' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 3m
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb73ac053f' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: heavy
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb228ca66d' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: never
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb40024fd3' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 0h
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb57c6c679' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 1h
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3b105ef4' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: 4h
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2fca0377' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Control
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb77a99223' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: form
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb1db97535' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: True positive rate (TPR)
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7abdf9d1' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: \bfseries{}(I) DE-test Power
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb4e5c474b' 'tikzStringWidthCalc.tex'
##
## Measuring dimensions of: Comparison of \textcolor{red}{LEMUR} against four other \textcolor{gray!90}{DE. methods}
##
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfbc4cb51e' 'tikzStringWidthCalc.tex'
##
## gg[gg16]
## Warning: Removed 50 rows containing non-finite outside the scale range
## (`stat_bin()`).
## Warning: Removed 10 rows containing missing values or values outside the scale
## range (`geom_bar()`).
## Measuring dimensions of: 1,000
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6cae1' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: 10,000
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3df179ca' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Global
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3872dc8b' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cluster*
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb7ced46a0' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Cell type*
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb3db7f273' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: miloDE*
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb778e7bac' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: No. genes
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb2b599686' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: \bfseries{}(J) Power by no. cell with expr. change
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6a94da6' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: Fraction of simulated genes (\textcolor{gray!60!black}{grey}) with $\textrm{FDR} < 0.1$ (\textcolor{blue!60!black}{blue})
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb5528d0b4' 'tikzStringWidthCalc.tex'
## Measuring dimensions of: No. cells with expr. change (log scale)
## Running command: '/Library/TeX/texbin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/dc/tppjxs9x6ll378lq88lz1fm40000gq/T//RtmpVxX3pz/tikzDevice12dfb6a9e0519' 'tikzStringWidthCalc.tex'
## gg[gg17]
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE
sessionInfo()
## R version 4.3.2 (2023-10-31)
## Platform: x86_64-apple-darwin20 (64-bit)
## Running under: macOS Sonoma 14.5
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: Europe/Berlin
## tzcode source: internal
##
## attached base packages:
## [1] stats4 stats graphics grDevices datasets utils methods
## [8] base
##
## other attached packages:
## [1] lemur_1.1.5 glue_1.6.2
## [3] lubridate_1.9.3 forcats_1.0.0
## [5] stringr_1.5.0 dplyr_1.1.3
## [7] purrr_1.0.2 readr_2.1.4
## [9] tidyr_1.3.0 tibble_3.2.1
## [11] ggplot2_3.5.1 tidyverse_2.0.0
## [13] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2
## [15] Biobase_2.60.0 GenomicRanges_1.52.1
## [17] GenomeInfoDb_1.36.4 IRanges_2.34.1
## [19] S4Vectors_0.38.2 BiocGenerics_0.46.0
## [21] MatrixGenerics_1.12.3 matrixStats_1.0.0
##
## loaded via a namespace (and not attached):
## [1] bitops_1.0-7 rlang_1.1.1 magrittr_2.0.3
## [4] RcppAnnoy_0.0.21 compiler_4.3.2 png_0.1-8
## [7] vctrs_0.6.3 pkgconfig_2.0.3 crayon_1.5.2
## [10] fastmap_1.1.1 XVector_0.40.0 labeling_0.4.3
## [13] utf8_1.2.3 Rsamtools_2.16.0 rmarkdown_2.25
## [16] tzdb_0.4.0 ggbeeswarm_0.7.2 strawr_0.0.91
## [19] bit_4.0.5 xfun_0.40 zlibbioc_1.46.0
## [22] cachem_1.0.8 jsonlite_1.8.7 DelayedArray_0.26.7
## [25] BiocParallel_1.34.2 irlba_2.3.5.1 parallel_4.3.2
## [28] R6_2.5.1 plyranges_1.20.0 bslib_0.5.1
## [31] stringi_1.7.12 RColorBrewer_1.1-3 rtracklayer_1.60.1
## [34] jquerylib_0.1.4 Rcpp_1.0.11 knitr_1.44
## [37] clisymbols_1.2.0 filehash_2.4-5 Matrix_1.6-1.1
## [40] timechange_0.2.0 tidyselect_1.2.0 rstudioapi_0.15.0
## [43] abind_1.4-5 yaml_2.3.7 codetools_0.2-19
## [46] curl_5.1.0 lattice_0.21-9 withr_2.5.1
## [49] ggrastr_1.0.2 evaluate_0.22 gridGraphics_0.5-1
## [52] isoband_0.2.7 Biostrings_2.68.1 pillar_1.9.0
## [55] BiocManager_1.30.22 renv_1.0.3 generics_0.1.3
## [58] vroom_1.6.4 RCurl_1.98-1.12 tidylog_1.0.2
## [61] plotgardener_1.6.4 hms_1.1.3 munsell_0.5.0
## [64] scales_1.3.0 tikzDevice_0.12.5 tools_4.3.2
## [67] BiocIO_1.10.0 data.table_1.14.8 GenomicAlignments_1.36.0
## [70] fs_1.6.3 XML_3.99-0.14 Cairo_1.6-1
## [73] cowplot_1.1.3 grid_4.3.2 colorspace_2.1-0
## [76] GenomeInfoDbData_1.2.10 beeswarm_0.4.0 restfulr_0.0.15
## [79] vipor_0.4.5 cli_3.6.1 fansi_1.0.5
## [82] S4Arrays_1.0.6 uwot_0.1.16 gtable_0.3.4
## [85] glmGamPoi_1.12.2 ggh4x_0.2.6 yulab.utils_0.1.0
## [88] sass_0.4.7 digest_0.6.33 ggplotify_0.1.2
## [91] farver_2.1.1 rjson_0.2.21 memoise_2.0.1
## [94] htmltools_0.5.6.1 lifecycle_1.0.3 MASS_7.3-60
## [97] bit64_4.0.5